import { getProvince, getChildArea } from "@/api/system/division"

export const useMajorProjectStore = defineStore('majorProject', {
  state: () => {
    return {
      provinceData: []
    }
  },
  actions: {
    async getProvinceData() {
      let result = await getProvince()
      if(result.code == 200){
        this.provinceData = result.data
      }
    },
    async getCityData(value) {
      let result = await getChildArea(value)
      if(result.code == 200){
        return Promise.resolve(result.data)
      }else {
        return Promise.reject('error')
      }
    },
    async getAreaData(value){
      let result = await getChildArea(value)
      if(result.code == 200){
        return Promise.resolve(result.data)
      }else {
        return Promise.reject('error')
      }
    }
  }
})